<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<meta charset="utf-8">
<title>客户-基本信息</title>
<link  type="text/css" rel="stylesheet"  href="<%=request.getContextPath()%>/static/index/css/style.css"/>
<link  type="text/css" rel="stylesheet"  href="<%=request.getContextPath()%>/static/index/css/index.css"/>
<script  src="/static/js/jquery-1.12.4.js"></script>
    <link rel="stylesheet" href="/static/css/bootstrap.css"/>
<!-- 动态菜单JS -->
<script type="text/javascript"  src="/static/js/menu.js"></script>
    <script type="text/javascript" src="/static/js/bootstrap.js"></script>

</head>

<body>
<script>

    function del(PHONE) {
        if (confirm("是否确认删除？")){
            window.location.href="/Customer/Customerdel?PHONE="+PHONE;
        }
        /*alert("确定删除");*/
    }
    window.onload=function () {
        var meg=$("#meg").val();
        if(meg=="del"){
            alert("删除成功！")
        }
    }
    /*修改*/
    function set(PHONE) {
        if (confirm("确定修改吗？")){
            window.location.href="/Customer/CustomerSet?PHONE="+PHONE;
            alert("是的");
        }

    }
    /*搜索*/
    function submit() {
        alert("搜索");
    }

    /*获取会员下拉框值*/

    /*  var  myselect=document.getElementById("huiyuan");//拿到select对象
      var index=myselect.selectedIndex;//拿到选中项的索引
      myselect.options[index].value;//拿到选中项options的value
      myselect.options[index].text;//拿到选中项options的text*/

    function xuanzhong(){
        var  myselect=document.getElementById("huiyuan");//拿到select对象
        var index=myselect.selectedIndex;//拿到选中项的索引
        // var index=myselect.selectedIndex;//拿到选中项的索引
        var zhi= myselect.options[index].text;
        location.href="${pageContext.request.contextPath }/Customer/CustomerSe?zhi="+zhi;

    }

</script>

<div class="container">
 <%--顶部公共部分--%>
 <jsp:include page="common/top.jsp" />
 <div class="left-menu" style="height:949px;">
  <%--左侧菜单列表--%>
  <jsp:include page="common/left-menu-list.jsp" />
 </div>
     <input type="hidden" value="${meg}" id="meg">
 <div class="right-menu">
  <div class="main-hd">
   <div class="page-teb" >
    <div class="l-tab-links">
     <ul style="left:0;">
      <li class="l-select">
       <a href="/user/index">首页</a>
      </li>
       <li class="l-select">
       <a href="#">客户管理</a>
      </li>
     </ul>
    </div>

    <div class="l-tab-content" style="background:#fff;">
     <div class="tab-content-item">
      <div class="home">
      <!--员工管理   开始-->
        <div class="yg-gl">
         <div class="yg-add">
      <%--    <button  class="ui-xz" data-method="offset" >新增</button>
          <button  class="ui-xz1" data-method="offset" >删除</button>
          <button  class="ui-xz2" data-method="offset" >编辑</button>--%>
          <div style="position: absolute;left: 20px" >
          <img src="/static/index/img/icon_face_default.png" style="height: 50%" width="40%" >
          </div>
        <div style="position: absolute;left: 95px;top:30px;" >
         <img src="/static/index/img/logo.PNG" style="height: 50%" width="85%" >
        </div>
          <!--时间-->


          <%--分类搜索--%>
          <form action="${pageContext.request.contextPath }/Customer/CustomerPhone" method="Get"
                style="padding-top: 10px;">
              <div style="position:absolute;right: 100px;top: 20px;font-size: 16px">
               <select name="huiyuan" id="huiyuan" onchange="xuanzhong()">
                <option value="">请选择</OPTION>
                   <option value="1" <c:if test="${zhi == '普卡'}">selected="selected"</c:if> >普卡</option>
                <option value="2" <c:if test="${zhi == '银卡'}">selected="selected"</c:if> >银卡</option>
                <option value="3"<c:if test="${zhi == '金卡'}">selected="selected"</c:if> >金卡</option>
                <option value="4"<c:if test="${zhi == '铂卡'}">selected="selected"</c:if> >铂卡 </option>
               </select>
                  <input style="border: 1px solid;color: #0FB9EF" placeholder="请输入客户电话"  value="${phone}"   type="text" name="phone">
                  <button type="submit">搜索</button>
                <%--  <a href="/user/usersave">新增</a>--%>
              </div>
           </form>
         </div>
         <div class="yg-tab">
          <div class="grid">
          <div class="layoutitem" style="width:100%;border:none;">
           <form method="post"> 
            <table class="gridbar" border="0" cellpadding="0" cellspacing="0">
            <thead>
            <tr>
             <th>身证号码</th>
             <th>客户名称</th>
             <th>性别</th>
             <th>地址</th>
             <th>电话</th>
             <th>职业</th>
                <th>客户密码</th>
                <th>会员等级</th>
             <th style="color: #1c2b36;text-align: center;width: 1px">删除</th>
             <th style="color: #1c2b36;text-align: center;width: 1px">修改</th>
            </tr>
            <c:forEach var="list" items="${pageInfo.list}">
            <tr>

              <td>${list.IDENTITY}</td>
              <td>${list.CUSTNAME}</td>
              <td>${list.SEX}</td>
              <td>${list.ADDRESS}</td>
              <td>${list.PHONE}</td>
              <td>${list.CAREER}</td>
              <td>${list.CUSTPWD}</td>
                <td>${list.MEMBERSHIP}</td>
               <%-- class="btn btn-primary"--%>
               <td>
                <button type="button"  class="btn btn-primary btn-md" data-toggle="modal" data-target="#${list.IDENTITY}" >
                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                    编辑
                </button>
                </td>
                <%--<td  style="background-color: #9ddcfb;align-content: center"> <a href="#" onclick="set('${list.PHONE}');">修改</a></td>--%>
           <%--
           <button class="btn btn-danger" >   <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                      <a style="color: white" href="#" onclick="del('${list.PHONE}');">删除</a>
                  </button>
                   --%>
              <td  style="balign-content: center">
                  <button class="btn btn-danger" >   <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                      <a style="color: white" href="#" onclick="del('${list.PHONE}');">删除</a>
                  </button>
              </td>

            </tr>
            </c:forEach>
             </thead>
            </table>
            </form>
           </div>

              <link  type="text/css" rel="stylesheet"  href="<%=request.getContextPath()%>/static/css/bootstrap.css"/>

              <style>
                  .container{
                      background: #FFFFFF;
                      width: 100%;
                      height: 50%;
                      padding: 0;

                  }
                  th{
                      text-align: center;
                  }

              </style>

              <%--分页位--%>
              <!--显示分页信息-->
              <div class="row">
                  <!--文字信息-->
                  <div class="col-md-6">
                      <br>
                      当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录
                  </div>

                  <!--点击分页-->
                  <div class="col-md-6">
                      <nav aria-label="Page navigation">
                          <ul class="pagination">

                              <li><a href="${pageContext.request.contextPath}/Customer/CustomerPhone?pageNum=1">首页</a></li>

                              <!--上一页-->
                              <li>
                                  <c:if test="${pageInfo.hasPreviousPage}">
                                      <a href="${pageContext.request.contextPath}/Customer/CustomerPhone?pageNum=${pageInfo.pageNum-1}" aria-label="Previous">
                                          <span aria-hidden="true">«</span>
                                      </a>
                                  </c:if>
                              </li>

                              <!--循环遍历连续显示的页面，若是当前页就高亮显示，并且没有链接-->
                              <c:forEach items="${pageInfo.navigatepageNums}" var="page_num">
                                  <c:if test="${page_num == pageInfo.pageNum}">
                                      <li class="active"><a href="#">${page_num}</a></li>
                                  </c:if>
                                  <c:if test="${page_num != pageInfo.pageNum}">
                                      <li><a href="${pageContext.request.contextPath}/Customer/CustomerPhone?pageNum=${page_num}">${page_num}</a></li>
                                  </c:if>
                              </c:forEach>

                              <!--下一页-->
                              <li>
                                  <c:if test="${pageInfo.hasNextPage}">
                                      <a href="${pageContext.request.contextPath}/Customer/CustomerPhone?pageNum=${pageInfo.pageNum+1}"
                                         aria-label="Next">
                                          <span aria-hidden="true">»</span>
                                      </a>
                                  </c:if>
                              </li>
                              <li><a href="${pageContext.request.contextPath}/Customer/CustomerPhone?pageNum=${pageInfo.pages}">尾页</a></li>
                          </ul>
                      </nav>
                  </div>
              </div>

                 <%--分页位置--%>
          </div>
         </div>
        </div>

      <!--员工管理   结束-->
      </div>
     </div>
    </div>
   </div>
  </div>
 </div>
</div>

<c:forEach var="list" items="${pageInfo.list}">
<!-- Modal -->
<div class="modal fade" id="${list.IDENTITY}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">客户修改</h4>
            </div>
            <div class="modal-body">
                <%--修改内容 --%>
                <form action="<%=path %>/user/userupd" method="post" id="form">
                    <div style="width: 600px; padding:10px 30px;border: 1px solid #000;">
                        <h1>修改员工信息</h1>
                        <table cellpadding="0" cellspacing="0" border="1" width="100%">
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                        ${list.CUSTNAME}   身份证号码:<input type="hidden" name="username" value="${list.CUSTNAME}"></td>

                                <td align="left" style="padding-left: 10px;">
                                    <input type="text" name="identity" id="identity" value="${userEntity.identity}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    全名:</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="fullname" id="fullname" value="${userEntity.fullname}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>性别</span>
                                </td>
                                <td class="item-input">
                                    <label class="item-label"><i>*</i>男</label>
                                    <input type="radio"  id="male" name="sex" value="男"  checked="checked">

                                    <label class="item-label"><i>*</i>女</label>
                                    <input type="radio"  id="female" name="sex" value="女">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    地址</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="address" id="address"  value="${userEntity.address}">
                                </td>
                            </tr>

                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    电话</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="phone" id="phone"  value="${userEntity.phone}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    职业</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="position" id="position"  value="${userEntity.position}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    职位级别</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="userlevel" id="userlevel"  value="${list.CUSTNAME}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    密码</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="userpwd" id="userpwd"  value="${userEntity.userpwd}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="padding-right: 10px;"><span>*</span>
                                    QQ号</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="userQQ" id="userQQ"  value="${userEntity.userQQ}">
                                </td>
                            </tr>

                            <tr>
                                <td align="right" style="padding-right: 10px;">注册日期（yyyy-MM-dd):</td>
                                <td align="left" style="padding-left: 10px;"><input
                                        type="text" name="USERDLDATE" id="USERDLDATE"  value="<fmt:formatDate
							value="${userEntity.USERDLDATE}" pattern="yyyy-MM-dd" />">
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2" style="padding: 10px;"><input
                                        type="submit" value="保存"> <input type="button" value="取消" onclick="index()">
                                </td>
                            </tr>
                        </table>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary">保存</button>
            </div>
        </div>
    </div>
</div>

</c:forEach>
</body>
</html>
